/*  
 *  Copyright 2006 Paul Jack.
 *
 *  This file is part of the Dex compiler suite. 
 *  
 *  Dex is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 2 of the License, or (at your
 *  option) any later version.
 *  
 *  Dex is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 *  Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */
package dex.compiler.model.program;

import dex.compiler.model.definition.Unit;


/**
 * Represents an entire Dex program.
 * 
 * @author pjack
 */
public interface Program {


	/**
	 * Loads a complete unit.  All statements and comments 
	 * must be preserved.
	 * 
	 * @param unitName  the unit to load
	 * @return          that unit, or null if it does not exist
	 */
	Unit loadComplete(String unitName);


	/**
	 * Loads the "profile" of a unit.  The profile does not contain
	 * comments, nor function bodies.  The profile can be used to see
	 * if symbols resolve correctly without having to keep the entire
	 * parse tree in memory.
	 * 
	 * Implementations are allowed to return the same thing as 
	 * loadComplete, however.  This method suggests to the implementation
	 * to conserve memory, but the implementation can ignore that advice.
	 * 
	 * @param unitName  the unit to load
	 * @return          that unit, or null if does not exist
	 */
	Unit loadProfile(String unitName);

	
	/**
	 * Returns true if the given unit exists.
	 * 
	 * @param unitName  the name of the unit to check
	 * @return  true if that unit exists, false otherwise
	 */
	boolean unitExists(String unitName);

}
